<template>
  <Layout :class="'bg-white p-2'">
    <!--第一行-->
    <Row :class="'m-0'">
      <Col span="4">
        <Input
          :class="'w-75 m-2'"
          v-model="name"
          placeholder="请输入学生姓名"
        />
      </Col>
      <Col span="4">
        <Input :class="'w-75 m-2'" v-model="tel" placeholder="请输入联系电话" />
      </Col>
      <Col span="4">
        <i-col :class="'w-75 m-2'">
          <Select
            v-model="source"
            placeholder="请输入线索来源"
            filterable
            clearable
          >
            <Option v-for="item in orsourceList" :value="item.value"
              >{{ item.label }}
            </Option>
          </Select>
        </i-col>
      </Col>
      <Col span="4">
        <Select
          :class="'w-75 m-2'"
          placeholder="请选择添加人"
          v-model="cu"
          filterable
          clearable
        >
          <Option v-for="item in autorList" :value="item.value"
            >{{ item.label }}
          </Option>
        </Select>
      </Col>
      <Col span="2">
        <Button
          type="primary"
          class="m-2 w-75"
          shape="circle"
          @click="search"
          icon="ios-search"
          >查询</Button
        >
      </Col>
      <Col span="2">
        <Button class="m-2 w-75" type="error" @click="newUser">+ 新增</Button>
      </Col>
    </Row>
    <!--第二行-->
    <Row :class="'m-0'">
      <Col span="3">
        <Date-picker
          :class="'w-100 m-2'"
          type="datetime"
          placeholder="放弃线索时间搜索"
          @on-change="resourceAbandonedSearchStartTimeChange"
        ></Date-picker>
      </Col>
      <div class="to">~</div>
      <Col span="3">
        <Date-picker
          :class="'w-100 m-2'"
          type="datetime"
          placeholder="放弃线索时间搜索"
          @on-change="resourceAbandonedSearchEndTimeChange"
        >
        </Date-picker>
      </Col>

      <Col span="4" push="1">
        <Date-picker
          :class="'w-75 m-2'"
          type="datetime"
          placeholder="接待日期搜索"
          @on-change="interviewSearchStartTimeChange"
        ></Date-picker>
      </Col>
      <div class="to">~</div>
      <Col span="4">
        <Date-picker
          :class="'w-75 m-2'"
          type="datetime"
          placeholder="接待日期搜索"
          @on-change="interviewSearchEndTimeChange"
        >
        </Date-picker>
      </Col>
      <Col span="2">
        <!-- excel批量导入组件 -->
        <Upload
          ref="upload"
          :action="url"
          name="file"
          :show-upload-list="true"
          :on-format-error="handleFormatError"
          :on-success="handleSuccess"
          :on-error="handleError"
          :format="['xlsx', 'xls']"
          :before-upload="handleBeforeUpload"
          with-credentials
        >
          <Button
            class="w-100"
            type="info"
            icon="ios-cloud-upload-outline"
            style="margin-top: 8px;"
            >批量导入</Button
          >
        </Upload>
      </Col>
    </Row>
    <!-- 第三行 -->
    <Row>
      <Col span="3">
        <Date-picker
          :class="'w-100 m-2'"
          type="datetime"
          placeholder="试听日期搜索"
          @on-change="trySearchStartTimeChange"
        >
        </Date-picker>
      </Col>
      <div class="to">~</div>
      <Col span="3">
        <!-- v-model="backviewSearchEndTime" -->
        <Date-picker
          :class="'w-100 m-2'"
          type="datetime"
          placeholder="试听日期搜索"
          @on-change="trySearchEndTimeChange"
        >
        </Date-picker>
      </Col>
      <Col span="4" push="1">
        <Date-picker
          :class="'w-75 m-2'"
          type="datetime"
          placeholder="报名时间搜索"
          @on-change="baomingSearchStartTimeChange"
        ></Date-picker>
      </Col>
      <div class="to">~</div>
      <Col span="4">
        <Date-picker
          :class="'w-75 m-2'"
          type="datetime"
          placeholder="报名时间搜索"
          @on-change="baomingSearchEndTimeChange"
        >
        </Date-picker>
      </Col>
    </Row>

    <!--第四行-->
    <Row>
      <Col span="3">
        <Date-picker
          :class="'w-100 m-2'"
          type="datetime"
          placeholder="线索添加日期搜索"
          @on-change="resourceCtSearchStartTimeChange"
        >
        </Date-picker>
      </Col>
      <div class="to">~</div>
      <Col span="3">
        <!-- v-model="backviewSearchEndTime" -->
        <Date-picker
          :class="'w-100 m-2'"
          type="datetime"
          placeholder="线索添加日期搜索"
          @on-change="resourceCtSearchEndTimeChange"
        >
        </Date-picker>
      </Col>
    </Row>

    <Layout :class="'bg-white'">
      <Table
        border
        :class="'m-1'"
        :columns="tableInfo.columnInfo"
        :data="tableInfo.data"
      >
        <!-- 名字超链接 -->
        <template slot-scope="{ row, index }" slot="name">
          <Row>
            <Col>
              <a @click="showPersonDetail(row)">{{ row.name }}</a>
            </Col>
          </Row>
        </template>
        <template slot-scope="{ row, index }" slot="status">
          <span v-if="row.statu">开</span>
          <span v-else>关</span>
        </template>

        <template slot-scope="{ row, index }" slot="action">
          <Row>
            <Button
              type="primary"
              size="small"
              style="margin-right: 5px"
              @click="tranferToResource(row)"
              :disabled="isTranferToResource"
              >转线索</Button
            >
          </Row>
        </template>
      </Table>

      <!--分页-->

      <Page
        class="pages"
        :class="'m-2 text-right'"
        :page-size="tableInfo.size"
        @on-change="pageSearch"
        :total="tableInfo.total"
        :current="tableInfo.page"
        show-sizer
        @on-page-size-change="changeSize"
      />
    </Layout>
    <Loadding :loadinghuan="isSpinShow"></Loadding>
  </Layout>
</template>

<script>
export default {
  data() {
    let self = this
    return {
      url: '',
      iport: '',
      isSpinShow: false,
      isTranferToResource: '',
      autorUserId: {},
      userList: {},
      autorList: [],
      name: '',
      tel: '',
      source: '',
      cu: '',
      resourceCtSearchStartTime: '',
      resourceCtSearchEndTime: '',
      resourceAbandonedSearchStartTime: '',
      resourceAbandonedSearchEndTime: '',
      interviewSearchStartTime: '',
      interviewSearchEndTime: '',
      trySearchStartTime: '',
      trySearchEndTime: '',
      baomingSearchStartTime: '',
      baomingSearchEndTime: '',
      tableInfo: {
        currentPage: 1,
        size: 10,
        total: 0,
        pageSize: 0,
        columnInfo: [
          //表头-----------------------------------
          {
            title: '#',
            width: 80,
            fixed: 'left',
            align: 'center',
            render: (h, params) => {
              return h(
                'span',
                params.index +
                  (self.tableInfo.currentPage - 1) * self.tableInfo.size +
                  1
              )
            },
          },
          {
            title: '学生姓名',
            slot: 'name',
            width: 100,
            fixed: 'left',
          },
          {
            title: '学生电话',
            key: 'tel',
            width: 200,
            fixed: 'left',
          },
          {
            title: '线索来源',
            key: 'source',
            width: 160,
          },
          {
            title: '线索状态',
            key: 'statu',
            width: 160,
          },
          {
            title: '添加时间',
            key: 'ct',
            width: 200,
          },
          {
            title: '接待时间',
            key: 'interviewDateTime',
            width: 200,
          },
          {
            title: '试听时间',
            key: 'tryDateTime',
            width: 200,
          },
          {
            title: '报名时间',
            key: 'baomingDateTime',
            width: 200,
          },
          {
            title: '放弃时间',
            key: 'abandonedTime',
            width: 200,
          },
          {
            title: '添加人',
            key: 'cu',
            width: 150,
          },
          {
            title: '操作',
            slot: 'action',
            width: 150,
            fixed: 'right',
          },
        ],
        data: [],
      },
      orsourceList: [
        { value: '58同城', label: '58同城' },
        { value: '智联招聘', label: '智联招聘' },
        { value: '前程无忧', label: '前程无忧' },
        { value: 'boss直聘', label: 'boss直聘' },
        { value: '拉勾网', label: '拉勾网' },
        { value: '51job', label: '51job' },
        { value: '其他', label: '其他' },
      ],
    }
  },
  methods: {
    showPersonDetail: function(row) {
      this.$router.push({
        name: 'student_detail',
        params: {
          row,
        },
      })
    },
    handleBeforeUpload: function() {
      let self = this
      return new Promise(function(resolve, reject) {
        self.$Modal.confirm({
          title: '上传提示',
          content: '即将上传文件，确定吗？',

          onOk: () => {
            resolve()
          },
          onCancel: () => {
            reject()
            self.message.info('操作已取消')
          },
        })
      })
    },
    handleFormatError(file) {
      this.$Notice.warning({
        title: '文件格式不正确',
        desc: '文件 ' + file.name + ' 格式不正确，请上传.xls,.xlsx文件。',
      })
    },
    handleSuccess(res, file) {
      if (res.STATUS === 'SUCCESS') {
        this.dialoLead = false
        this.$Message.success('数据导入成功！')
        this.searchResourceList()
        this.$refs.upload.clearFiles()
      } else {
        this.$Message.success(res.MESSAGE)
      }
    },
    handleError(error, file) {
      this.$Message.error('数据导入失败！')
    },
    newUser: function() {
      this.$router.push({
        name: 'resource_new',
      })
    },
    tranferToResource: function(row) {
      this.$Modal.confirm({
        title: '转线索',

        render: (h, params) => {
          return h(
            'Select',
            {
              props: {
                value: row.autor, // 获取选择的下拉框的值
                size: 'small',
              },
              on: {
                'on-change': (val) => {
                  this.autorUserId = val
                },
              },
            },
            this.autorList.map(function(item) {
              return h('Option', {
                props: {
                  value: item.value,
                  label: item.label,
                },
              })
            })
          )
        },

        onOk: () => {
          this.$Loading.start()
          this.isSpinShow = true
          this.http
            .post({
              url: '/resource/transfer',
              param: {
                'resource.id': row.resourceId,
                'resource.source': row.source,
                'resource.ypzw': row.ypzw,
                'resource.csgz': row.csgz,
                'resource.tdgsmc': row.tdgsmc,
                'resource.bz': row.bz,
                'resource.cu': this.$data.userList.user.userId,
                'resource.autor': this.autorUserId,

                'student.id': row.studentId,
                'student.name': row.name,
                'student.tel': row.tel,
                'student.secId': row.secId,
                'student.secFrontUrl': row.secFrontUrl,
                'student.secBackUrl': row.secBackUrl,
                'student.secHandleUrl': row.secHandleUrl,
                'student.account': row.account,
                'student.accountTel': row.accountTel,
                'student.address': row.address,
                'student.email': row.email,
                'student.degree': row.degree,
                'student.major': row.major,
                'student.graduate': row.graduate,
                'student.birth': row.birth,
                'student.graduateTime': row.graduateTime,
                'student.cu': this.$data.userList.user.userId,

                'resourceRecord.id': row.resourceId,
                'resourceRecord.content': row.content,
                'resourceRecord.comment': row.comment,
                'resourceRecord.cu': this.$data.userList.user.userId,
              },
            })
            .then((data) => {
              this.isSpinShow = false
              this.$Loading.finish()
              this.search()
              self.message.info('新增成功')
            })
        },
        onCancel: () => {
          this.message.info('操作已取消')
        },
      })
    },
    resourceCtSearchStartTimeChange: function(startTime) {
      this.resourceCtSearchStartTime = startTime
    },
    resourceCtSearchEndTimeChange: function(endTime) {
      this.resourceCtSearchEndTime = endTime
    },
    resourceAbandonedSearchStartTimeChange: function(startTime) {
      this.resourceAbandonedSearchStartTime = startTime
    },
    resourceAbandonedSearchEndTimeChange: function(endTime) {
      this.resourceAbandonedSearchEndTime = endTime
    },
    interviewSearchStartTimeChange: function(startTime) {
      this.interviewSearchStartTime = startTime
    },
    interviewSearchEndTimeChange: function(endTime) {
      this.interviewSearchEndTime = endTime
    },
    trySearchStartTimeChange: function(startTime) {
      this.trySearchStartTime = startTime
    },
    trySearchEndTimeChange: function(endTime) {
      this.trySearchEndTime = endTime
    },
    baomingSearchStartTimeChange: function(startTime) {
      this.baomingSearchStartTime = startTime
    },
    baomingSearchEndTimeChange: function(endTime) {
      this.baomingSearchEndTime = endTime
    },
    changeSize: function(changeSize) {
      this.$data.tableInfo.size = changeSize
    },
    init: function() {
      //在session中取出当前用户权限并校验绑定跟进人条件检索的选择框
      let currentUser = JSON.parse(sessionStorage.getItem('CURRENT_USER'))
      currentUser.permissions.forEach((twopermission) => {
        twopermission.permissions.forEach((per) => {
          if (per.name == '可分配') {
            this.isTranferToResource = false
          }
        })
      })

      this.$data.tableInfo.currentPage = 1

      let paramPOJO = {
        page: this.$data.tableInfo.currentPage, //默认1
        size: this.$data.tableInfo.size, //默认每页10条
      }
      this.http
        .get({
          url: '/resources/public/list',
          param: paramPOJO,
        })
        .then((data) => {
          var POJOList = new Array()

          //外层循环
          data.list.forEach((list) => {
            //外层循环
            let userList = JSON.parse(localStorage.getItem('USER_LIST'))
            let autorName = null
            userList.forEach((user) => {
              //内层循环
              if (user.userId == list.cu) {
                autorName = user.nickName
              }
            }) //内存循环
            let POJO = {
              studentId: list.studentId,
              name: list.name,
              secId: list.secId,
              secFrontUrl: list.secFrontUrl,
              secBackUrl: list.secBackUrl,
              secHandleUrl: list.secHandleUrl,
              tel: list.tel,
              account: list.account,
              accountTel: list.accountTel,
              address: list.address,
              eMail: list.email,
              degree: list.degree,
              major: list.major,
              graduate: list.graduate,
              birth: list.birth,
              graduateTime: list.graduateTime,
              studentCu: list.studentCu,
              studentCt: list.studentCt,
              studentUt: list.studentUt,
              studentUu: list.studentUu,

              resourceId: list.resourceId,
              source: list.source,
              statu: list.statu,
              ypzw: list.ypzw,
              csgz: list.csgz,
              tdgsmc: list.tdgsmc,
              bz: list.bz,
              resourceAutor: list.resourceAutor,
              ct: list.ct,
              abandonedTime: list.abandonedTime,
              cu: autorName,
              uu: list.uu,

              resourceRecordId: list.resourceRecordId,
              comment: list.comment,
              content: list.content,
              resourceRecordAutor: list.resourceRecordAutor,
              resrouceRecordCt: list.resrouceRecordCt,
              resrouceRecordUt: list.resrouceRecordUt,
              resrouceRecordCu: list.resrouceRecordCu,
              resrouceRecordUu: list.resrouceRecordUu,

              interviewDateTime: list.interviewDateTime,
              tryDateTime: list.tryDateTime,
              baomingDateTime: list.baomingDateTime,
            }
            POJOList.push(POJO)
          }) //外层循环

          this.$data.tableInfo.currentPage = data.page
          this.$data.tableInfo.total = data.totalCount
          this.$data.tableInfo.pageSize = data.totalPage
          this.$data.tableInfo.size = data.size
          this.$data.tableInfo.data = POJOList
        })
    },
    search: function() {
      //查询！！！！！！

      this.$data.tableInfo.currentPage = 1

      let resourceCtSearchStartTime = this.resourceCtSearchStartTime
      let resourceCtSearchEndTime = this.resourceCtSearchEndTime
      let resourceAbandonedSearchStartTime = this
        .resourceAbandonedSearchStartTime
      let resourceAbandonedSearchEndTime = this.resourceAbandonedSearchEndTime
      let interviewSearchStartTime = this.interviewSearchStartTime
      let interviewSearchEndTime = this.interviewSearchEndTime
      let trySearchStartTime = this.trySearchStartTime
      let trySearchEndTime = this.trySearchEndTime
      let baomingSearchStartTime = this.baomingSearchStartTime
      let baomingSearchEndTime = this.baomingSearchEndTime

      if (resourceCtSearchStartTime == '') {
        resourceCtSearchStartTime = null
      }

      if (resourceCtSearchEndTime == '') {
        resourceCtSearchEndTime = null
      }

      if (resourceAbandonedSearchStartTime == '') {
        resourceAbandonedSearchStartTime = null
      }

      if (resourceAbandonedSearchEndTime == '') {
        resourceAbandonedSearchEndTime = null
      }

      if (interviewSearchStartTime == '') {
        interviewSearchStartTime = null
      }

      if (interviewSearchEndTime == '') {
        interviewSearchEndTime = null
      }

      if (trySearchStartTime == '') {
        trySearchStartTime = null
      }

      if (trySearchEndTime == '') {
        trySearchEndTime = null
      }

      if (baomingSearchStartTime == '') {
        baomingSearchStartTime = null
      }

      if (baomingSearchEndTime == '') {
        baomingSearchEndTime = null
      }

      let paramPOJO = {
        //查询参数
        page: this.$data.tableInfo.currentPage, //默认1
        size: this.$data.tableInfo.size, //默认每页10条
        name: this.name,
        tel: this.tel,
        cu: this.cu,
        source: this.source,
        resourceCtSearchStartTime: resourceCtSearchStartTime,
        resourceCtSearchEndTime: resourceCtSearchEndTime,
        resourceAbandonedSearchStartTime: resourceAbandonedSearchStartTime,
        resourceAbandonedSearchEndTime: resourceAbandonedSearchEndTime,
        interviewSearchStartTime: interviewSearchStartTime,
        interviewSearchEndTime: interviewSearchEndTime,
        trySearchStartTime: trySearchStartTime,
        trySearchEndTime: trySearchEndTime,
        baomingSearchStartTime: baomingSearchStartTime,
        baomingSearchEndTime: baomingSearchEndTime,
      }

      this.http
        .get({
          url: '/resources/public/list',
          param: paramPOJO,
        })
        .then((data) => {
          //转化autorID ->autorName
          var POJOList = new Array()

          //外层循环
          data.list.forEach((list) => {
            //外层循环
            let userList = JSON.parse(localStorage.getItem('USER_LIST'))
            let autorName = null
            userList.forEach((user) => {
              //内层循环
              if (user.userId == list.cu) {
                autorName = user.nickName
              }
            }) //内存循环
            let POJO = {
              studentId: list.studentId,
              name: list.name,
              secId: list.secId,
              secFrontUrl: list.secFrontUrl,
              secBackUrl: list.secBackUrl,
              secHandleUrl: list.secHandleUrl,
              tel: list.tel,
              account: list.account,
              accountTel: list.accountTel,
              address: list.address,
              eMail: list.email,
              degree: list.degree,
              major: list.major,
              graduate: list.graduate,
              birth: list.birth,
              graduateTime: list.graduateTime,
              studentCu: list.studentCu,
              studentCt: list.studentCt,
              studentUt: list.studentUt,
              studentUu: list.studentUu,

              resourceId: list.resourceId,
              source: list.source,
              statu: list.statu,
              ypzw: list.ypzw,
              csgz: list.csgz,
              tdgsmc: list.tdgsmc,
              bz: list.bz,
              resourceAutor: list.resourceAutor,
              ct: list.ct,
              abandonedTime: list.abandonedTime,
              cu: autorName,
              uu: list.uu,

              resourceRecordId: list.resourceRecordId,
              comment: list.comment,
              content: list.content,
              resourceRecordAutor: list.resourceRecordAutor,
              resrouceRecordCt: list.resrouceRecordCt,
              resrouceRecordUt: list.resrouceRecordUt,
              resrouceRecordCu: list.resrouceRecordCu,
              resrouceRecordUu: list.resrouceRecordUu,

              interviewDateTime: list.interviewDateTime,
              tryDateTime: list.tryDateTime,
              baomingDateTime: list.baomingDateTime,
            }
            POJOList.push(POJO)
          }) //外层循环

          this.$data.tableInfo.currentPage = data.page
          this.$data.tableInfo.total = data.totalCount
          this.$data.tableInfo.pageSize = data.totalPage
          this.$data.tableInfo.size = data.size
          this.$data.tableInfo.data = POJOList
        })
    },
    pageSearch: function(changedPage) {
      let resourceCtSearchStartTime = this.resourceCtSearchStartTime
      let resourceCtSearchEndTime = this.resourceCtSearchEndTime
      let resourceAbandonedSearchStartTime = this
        .resourceAbandonedSearchStartTime
      let resourceAbandonedSearchEndTime = this.resourceAbandonedSearchEndTime
      let interviewSearchStartTime = this.interviewSearchStartTime
      let interviewSearchEndTime = this.interviewSearchEndTime
      let trySearchStartTime = this.trySearchStartTime
      let trySearchEndTime = this.trySearchEndTime
      let baomingSearchStartTime = this.baomingSearchStartTime
      let baomingSearchEndTime = this.baomingSearchEndTime

      if (resourceCtSearchStartTime == '') {
        resourceCtSearchStartTime = null
      }

      if (resourceCtSearchEndTime == '') {
        resourceCtSearchEndTime = null
      }

      if (resourceAbandonedSearchStartTime == '') {
        resourceAbandonedSearchStartTime = null
      }

      if (resourceAbandonedSearchEndTime == '') {
        resourceAbandonedSearchEndTime = null
      }

      if (interviewSearchStartTime == '') {
        interviewSearchStartTime = null
      }

      if (interviewSearchEndTime == '') {
        interviewSearchEndTime = null
      }

      if (trySearchStartTime == '') {
        trySearchStartTime = null
      }

      if (trySearchEndTime == '') {
        trySearchEndTime = null
      }

      if (baomingSearchStartTime == '') {
        baomingSearchStartTime = null
      }

      if (baomingSearchEndTime == '') {
        baomingSearchEndTime = null
      }

      this.$data.tableInfo.currentPage = changedPage //换页

      let paramPOJO = {
        page: this.$data.tableInfo.currentPage, //默认1
        size: this.$data.tableInfo.size, //默认每页10条
        name: this.name,
        tel: this.tel,
        cu: this.cu,
        source: this.source,
        resourceCtSearchStartTime: resourceCtSearchStartTime,
        resourceCtSearchEndTime: resourceCtSearchEndTime,
        resourceAbandonedSearchStartTime: resourceAbandonedSearchStartTime,
        resourceAbandonedSearchEndTime: resourceAbandonedSearchEndTime,
        interviewSearchStartTime: interviewSearchStartTime,
        interviewSearchEndTime: interviewSearchEndTime,
        trySearchStartTime: trySearchStartTime,
        trySearchEndTime: trySearchEndTime,
        baomingSearchStartTime: baomingSearchStartTime,
        baomingSearchEndTime: baomingSearchEndTime,
      }

      this.http
        .get({
          url: '/resources/public/list',
          param: paramPOJO,
        })
        .then((data) => {
          //转化autorID ->autorName
          var POJOList = new Array()

          //外层循环
          data.list.forEach((list) => {
            //外层循环
            let userList = JSON.parse(localStorage.getItem('USER_LIST'))
            let autorName = null
            userList.forEach((user) => {
              //内层循环
              if (user.userId == list.cu) {
                autorName = user.nickName
              }
            }) //内存循环
            let POJO = {
              //表头
              studentId: list.studentId,
              name: list.name,
              secId: list.secId,
              secFrontUrl: list.secFrontUrl,
              secBackUrl: list.secBackUrl,
              secHandleUrl: list.secHandleUrl,
              tel: list.tel,
              account: list.account,
              accountTel: list.accountTel,
              address: list.address,
              eMail: list.email,
              degree: list.degree,
              major: list.major,
              graduate: list.graduate,
              birth: list.birth,
              graduateTime: list.graduateTime,
              studentCu: list.studentCu,
              studentCt: list.studentCt,
              studentUt: list.studentUt,
              studentUu: list.studentUu,

              resourceId: list.resourceId,
              source: list.source,
              statu: list.statu,
              ypzw: list.ypzw,
              csgz: list.csgz,
              tdgsmc: list.tdgsmc,
              bz: list.bz,
              resourceAutor: list.resourceAutor,
              ct: list.ct,
              abandonedTime: list.abandonedTime,
              cu: autorName,
              uu: list.uu,

              resourceRecordId: list.resourceRecordId,
              comment: list.comment,
              content: list.content,
              resourceRecordAutor: list.resourceRecordAutor,
              resrouceRecordCt: list.resrouceRecordCt,
              resrouceRecordUt: list.resrouceRecordUt,
              resrouceRecordCu: list.resrouceRecordCu,
              resrouceRecordUu: list.resrouceRecordUu,

              interviewDateTime: list.interviewDateTime,
              tryDateTime: list.tryDateTime,
              baomingDateTime: list.baomingDateTime,
            }
            POJOList.push(POJO)
          }) //外层循环

          this.$data.tableInfo.currentPage = data.page
          this.$data.tableInfo.total = data.totalCount
          this.$data.tableInfo.pageSize = data.totalPage
          this.$data.tableInfo.size = data.size
          this.$data.tableInfo.data = POJOList
        })
    },
    // remove: function(pId) {

    // 	this.message.confirm({
    // 		title: "删除提示",
    // 		content: "即将删除权限，确定吗？",
    // 		onOk: () => {
    // 			this.http.delete({
    // 				url: "/backview/delete", //删除url 待定......
    // 				param: {

    // 				}
    // 			}).then(data => {
    // 				this.search();
    // 			});
    // 		},
    // 		onCancel: () => {
    // 			this.message.info('操作已取消');
    // 		}
    // 	});
    // },
    formatDate: function(date) {
      //格式化日期方法!
      var d = new Date(date),
        month = '' + (d.getMonth() + 1),
        day = '' + d.getDate(),
        year = d.getFullYear()

      if (month.length < 2) month = '0' + month
      if (day.length < 2) day = '0' + day

      return [year, month, day].join('-')
    },
  },
  created: function() {
    //在session中取出当前用户权限并校验绑定跟进人条件检索的选择框
    let currentUser = JSON.parse(sessionStorage.getItem('CURRENT_USER'))
    this.userList = currentUser
    this.iport = this.$store.state.iport
    this.url = this.iport + 'resource/excel/put'
    this.init()
    let userList = JSON.parse(localStorage.getItem('USER_LIST'))
    userList.forEach((user) => {
      let u = {
        value: user.userId,
        label: user.nickName,
      }
      this.autorList.push(u)
    })
  },
}
</script>

<style scoped>
.to {
  padding: 0.625rem 1.25rem 0px 2.5rem;
}
</style>
